<template>
  <div class="">
    home

    <van-input v-model="inputValue" @keydown="handleKey" />
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  props: {},
  components: {},
  data() {
    return {
      inputValue: ''
    }
  },
  created() {
    this.initDataFun() // 初始化数据
  },
  mounted() {},
  beforeDestroy() {},
  computed: {
    ...mapState({
      user: state => state.user.userInfo,
      homeChangeTabIndex: state => state.study.homeChangeTabIndex
    })
  },
  watch: {},
  methods: {
    // 初始化数据
    initDataFun() {
      this.$store.commit('toggleLoading', true)
      this.$store.commit('updateUserItem', {
        field: 'userInfo',
        value: { userName: '1', tel: '2345' }
      })
      this.$store.commit('updateStudyItemStore', {
        field: 'homeChangeTabIndex',
        value: null
      })
      setTimeout(() => {
        this.$store.commit('toggleLoading', false)
        console.log(this.user, this.homeChangeTabIndex)
      }, 2000)
    },
    handleKey(e) {
      console.log(e)
    }
  }
}
</script>

<style lang="less"></style>

<style lang="less" scoped></style>
